package com.mlf.abstractFactory.spring.ui;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ui")
public class UIController {
    @Autowired
    private UIService uiService;
    @Autowired
    private ThemeService themeService;


    // 渲染UI端点
    @GetMapping("/render")
    public String renderUI(@RequestParam String theme) {
        uiService.renderUI(theme);
        return "UI rendered with theme: " + theme;
    }

    // 获取可用主题列表
    @GetMapping("/themes")
    public List<String> getAvailableThemes() {
        return themeService.getAvailableThemes();
    }

}